<template>
  <div class="search_swiper">
    <div class="search_text">
      <span class="search_msg">输入搜索</span>
      <el-input placeholder="输入用户昵称或手机号......" v-model="search" clearable></el-input>
    </div>
    <div class="search_orderTime">
      <span class="search_msg">下单时间</span>
      <div class="block">
        <el-date-picker v-model="value1" type="date" placeholder="开始日期" prefix-icon="删除"></el-date-picker>
      </div>
      <span style="margin-left:15px;margin-right:15px;color:#ccc">—</span>
      <div class="block">
        <el-date-picker v-model="value2" type="date" placeholder="结束日期" prefix-icon="删除"></el-date-picker>
      </div>
    </div>
    <el-button type="primary" class="inquire" @click="searchFunBtn">查询</el-button>
    <el-button class="empty" @click="resetFun">重置</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      search: "",
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            }
          },
          {
            text: "昨天",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24);
              picker.$emit("pick", date);
            }
          },
          {
            text: "一周前",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", date);
            }
          }
        ]
      },
      value1: "",
      value2: ""
    };
  },
  methods: {
    searchFunBtn() {
      this.$emit("searchParent", this.search);
    },
    resetFun() {
      this.search = "";
      this.value1 = "";
      this.value2 = "";
      this.$emit("searchParent", "");
      // this.$parent.getData();
    }
  }
};
</script>

<style lang="less" scoped>
.search_swiper {
  height: 24px;
  background: #ffffff;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  padding: 15px 0px;
  /deep/.el-date-editor--date {
    width: 115px !important;
  }
  /deep/.el-input__inner {
    line-height: 30px;
  }
  .search_text {
    width: 330px;
    display: flex;
    margin-left: 30px;
    align-items: center;
    .search_msg {
      display: inline-block;
      width: 70px;
      height: 20px;
      line-height: 20px;
      font-family: "微软雅黑 Regular";
      font-size: 16px;
      font-weight: 600;
      margin-right: 10px;
    }
    /deep/input::-webkit-input-placeholder {
      color: #333333;
      font-size: 13px;
    }

    /deep/.el-input {
      width: 200px;
      height: 30px;
      color: green;
      .el-input__inner {
        height: 30px;
        padding-left: 15px;
      }
      .el-input__suffix {
        top: 0px;
      }
    }
  }
  .search_orderTime {
    display: flex;
    align-items: center;
    .search_msg {
      display: inline-block;
      width: 80px;
      height: 20px;
      line-height: 20px;
      font-family: "微软雅黑 Regular";
      font-size: 16px;
      font-weight: 600;
    }
    .el-date-editor {
      display: flex;
      align-items: center;
      width: 130px;
      height: 30px;
      /deep/input::-webkit-input-placeholder {
        color: #333333;
      }
      /deep/.el-input__inner {
        height: 30px;
        padding-left: 15px;
      }
    }
  }
  .inquire,
  .empty {
    width: 80px;
    height: 30px;
    // line-height: 30px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    margin-left: 30px;
  }
  .empty {
    color: #333333;
  }
}
</style>